package com.linjiahao.nettyTwo.handler;

import org.springframework.util.Assert;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @ClassName HandlerServiceFactory
 * @Description: 处理器工程类
 * @Author linjiahao
 * @Date 28/12/2021
 **/
public class HandlerServiceFactory {

    private static Map<String, AbstractHandle> serviceMap = new ConcurrentHashMap<String, AbstractHandle>();

    public static AbstractHandle getHandlerService(String serviceName){
        return  serviceMap.get(serviceName);
    }

    public static void register(String serviceName,AbstractHandle abstractHandle){
        Assert.notNull(serviceName,"实现类名不允许为空");
        serviceMap.put(serviceName,abstractHandle);
    }


}
